Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python, rust): add column operation #2562

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

ion-elgreco
Copy link
Collaborator

@ion-elgreco ion-elgreco commented Jun 2, 2024

Description

The schema evolution code is quite well abstracted from the writer, so it seemed straight forward to expose this through an add column api. This would make it easier for users to add new columns or fields in structs.

At some point we can add type widening to the schema evolution as a separate path, which also than could be used to create an alter column operation.

@github-actions github-actions bot added binding/python Issues for the Python package binding/rust Issues for the Rust crate labels Jun 2, 2024
@ion-elgreco ion-elgreco changed the title feat(python, rust): add column operation feat(python, rust): add column operation Jun 2, 2024
@ion-elgreco ion-elgreco marked this pull request as ready for review June 2, 2024 17:08
Copy link
Member

@rtyler rtyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is overall a good idea to add 👏

crates/core/src/kernel/models/actions.rs Show resolved Hide resolved
crates/core/src/operations/add_column.rs Show resolved Hide resolved
python/deltalake/table.py Outdated Show resolved Hide resolved
python/src/lib.rs Show resolved Hide resolved
crates/core/src/operations/add_column.rs Outdated Show resolved Hide resolved
crates/core/src/operations/add_column.rs Outdated Show resolved Hide resolved
fields: fields.into_iter().collect_vec(),
};

metadata.schema_string = serde_json::to_string(&new_table_schema)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out loud here, not feedback on this pull request, but implementing TryInto for StructType would probably be handle for us

@nadyr-mg
Copy link

nadyr-mg commented Jul 9, 2024

Hi, it's really a good idea to add such operation. Is there any update on this?

@ion-elgreco
Copy link
Collaborator Author

Hi, it's really a good idea to add such operation. Is there any update on this?

Unfortunately I am busy for the next 4+ months, after that I'll probably pick the pace up again on delta-rs

Copy link
Collaborator

@hntd187 hntd187 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks okay, I would like the starts_with addressed though

crates/core/src/kernel/models/actions.rs Outdated Show resolved Hide resolved
if self.min_writer_version >= 7 {
let mut converted_writer_features = configuration
.iter()
.filter(|(_, value)| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just understanding here, so this unwraps the value of the key, if it's already none, return false. If it's Some, parse it into a bool which you check is both ok and actually true, but then collect the hashmap back into a string?

Why not at this point just keep it bools because you just drop the values below anyways. Or better yet collect::<HashMap<_, _>>>() ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I need to first filter the hashmap for enabled configurations, to then try parse each key as a feature

crates/core/src/kernel/models/actions.rs Outdated Show resolved Hide resolved
crates/core/src/operations/write.rs Show resolved Hide resolved
@ion-elgreco ion-elgreco added this pull request to the merge queue Aug 4, 2024
Merged via the queue into delta-io:main with commit 878cf37 Aug 4, 2024
21 checks passed
@ion-elgreco ion-elgreco deleted the feat/alter_column branch August 4, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package binding/rust Issues for the Rust crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants